
package com.kanjian.music.api;

import com.android.volley.Request.Method;
import com.kanjian.music.KanjianApplication;

public class ApiURL {

    public static final String HTTP_PROTOCOL = "http://";

    public static final String TEST_DOMAIN = "test-open.kanjian.com/m/";

    public static final String DOMAIN = TEST_DOMAIN; // "open.kanjian.com/m/";

    public static final String URL_ACTION_GET_BANNER = "get_banner";

    public static final String URL_ACTION_MAY_LIKE = "may_like";

    public static final String URL_ACTION_RECOMMEND = "recommend";

    public static final String URL_ACTION_NICE = "nice";

    public static final String URL_ACTION_RANKING_TITLE = "ranking_title";

    public static final String URL_ACTION_RANK_DETAIL = "rank_detail";

    public static final String URL_ACTION_MY_FAVORTE = "my_favorte";

    public static final String URL_ACTION_RADIO = "radio";

    public static final String URL_ACTION_DEL_RADIO_MUSIC = "del_radio_music/";

    public static final String URL_ACTION_FEED = "feed"; // 邂逅

    public static final String URL_ACTION_ACTIVITY = "activity"; // 直播活动列表

    public static final String URL_ACTION_NEXT_ACTIVITY = "next_activity";

    public static final String URL_ACTION_ACTIVITY_DETAIL = "activity_detail";

    public static final String URL_ACTION_USER_LIST = "room/user_list";

    public static final String URL_ACTION_ROOM_STATUS = "room_status";

    public static final String URL_ACTION_REGISTER = "register";

    public static final String URL_ACTION_CHECK_USERNAME = "check_username";

    public static final String URL_ACTION_REGISTER_OPEN = "register_open";

    public static final String URL_ACTION_CHANGE_AVATAR = "change_avatar";

    public static final String URL_ACTION_LOGIN = "login";

    public static final String URL_ACTION_GENE = "gene/";

    public static final String URL_ACTION_SET_GENE = "gene";

    public static final String URL_ACTION_DO_LIKE = "do_like";

    public static final String URL_ACTION_FOLLOW = "follow";

    public static final String URL_ACTION_DO_FOLLOW = "do_follow";

    public static final String URL_ACTION_MESSAGE = "message";

    public static final String URL_ACTION_VER = "ver";

    public static final String URL_ACTION_FEEDBACK = "feedback";

    public static final String URL_ACTION_SEARCH = "search";

    public static final String URL_ACTION_SIMILAR_MUSIC = "similar_music";

    public static final String URL_ACTION_SONG = "song";

    public static final String URL_ACTION_MUSICIAN = "musician";

    public static final String URL_ACTION_LOGOUT = "logout/";

    public static String spellUrl(String action) {
        return ApiURL.HTTP_PROTOCOL + ApiURL.DOMAIN + action;
    }

    public static RequestEntity fixSid(RequestEntity request) {
        if (request.mMethod == Method.POST) {
            if (request.mParams == null || !request.mParams.containsKey("sid")) {
                if (KanjianApplication.SID != null) {
                    request.mParams.put("sid", KanjianApplication.SID);
                }
            }
        } else {
            if (!request.mUrl.contains("sid")) {
                if (KanjianApplication.SID != null) {
                    if (request.mUrl.contains("?")) {
                        request.mUrl += "&sid=" + KanjianApplication.SID;
                    } else {
                        request.mUrl += "?sid=" + KanjianApplication.SID;
                    }
                }
            }
        }
        return request;
    }

}
